﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {
    import flash.events.*;
    import Engine.Helpers.*;
    import Display.*;
    import GameMode.*;

    public class Decoration extends MapResource {

        private static const m_stadium:Stadium = null;

        protected const STATE_STATIC:String = "static";
        private const DECORATION:String = "decoration";

        public function Decoration(_arg1:String=null){
            super(_arg1);
            m_objectType = WorldObjectTypes.DECORATION;
            setState(this.STATE_STATIC);
            m_typeName = this.DECORATION;
        }
        override public function get autoRotate():Boolean{
            return (false);
        }
        override public function isSellable():Boolean{
            return (m_ownable);
        }
        override protected function getSellPrice():int{
            return (m_item.sellPrice);
        }
        override public function isPickable():Boolean{
            return (((super.isPickable()) && (Global.world.m_territory.pointInTerritory(m_position.x, m_position.y))));
        }
        override public function canBeDragged():Boolean{
            return (m_ownable);
        }
        override public function onMenuClick(_arg1:MouseEvent):void{
            var _local2:ContextMenuItem;
            if ((_arg1.target is ContextMenuItem)){
                _local2 = (_arg1.target as ContextMenuItem);
                switch (_local2.action){
                    case MOVE_OBJECT:
                        this.move();
                        break;
                    case SELL_OBJECT:
                        this.sell();
                        break;
                    default:
                        super.onMenuClick(_arg1);
                };
            };
        }
        override public function setHighlighted(_arg1:Boolean, _arg2:uint=16755200):void{
            if ((Global.world.getTopGameMode() is GMEdit)){
                super.setHighlighted(_arg1);
            } else {
                super.setHighlighted(false);
            };
        }
        override public function findValidCrowdPosition():Vector3{
            var _local1:Vector3 = new Vector3(Math.random(), Math.random());
            if (_local1.y > _local1.x){
                _local1 = new Vector3(_local1.y, _local1.x);
            };
            _local1.x = (1 - _local1.x);
            var _local2:Vector3 = this.getSize();
            _local1.x = (_local1.x * _local2.x);
            _local1.y = (_local1.y * _local2.y);
            return (new Vector3((m_position.x + _local1.x), (m_position.y + _local1.y)));
        }
        override public function isPlacedObjectNonBuilding():Boolean{
            return (true);
        }

    }
}//package Classes 
